{{ define "content" }}
<div class="search container">
  <div class="container">
    <div class="row">
      <form id="searchForm" class="search-form mb-3 p-0">
        <div class="input-group input-group-lg">
          <span class="btn btn-search disabled position-absolute left-0" type="submit" aria-label="submit"><i class="fas fa-fw fa-search"></i></span>
          <input class="form-control rounded ps-5" name="q" type="search" aria-label="Search">
        </div>
      </form>
      <div class="search-stat mb-3 p-0">
        <i id="loadingSpinner" class="fas fa-fw fa-spin fa-spinner"></i>
        <span id="searchStat"></span>
      </div>
    </div>
  </div>
  <div id="searchResults" class="search-results container mb-3"></div>
  <div class="text-center mb-3">
    <button class="btn btn-block btn-outline-primary d-none" type="button" id="btnLoadMore">{{ i18n "load_more" }}</button>
  </div>
</div>
<script type="text/html" id="templateResult">
  <div class="search-result row card component" id="{{ print "{{id}}" }}">
    <div class="card-header">
      <h2 class="card-title search-result-title">
        <a {{ printf "href={{permalink}}" | safeHTMLAttr }}>{{ print "{{title}}" }}</a>
      </h2>
    </div>
    <div class="card-body">
      <div class="post-meta mb-3">
        <span class="post-date">{{ printf "{{date}}" }}</span>
        {{- $baseURL := absLangURL "" -}}
        {{- $placeholder := "{{#url}}{{.}}{{/url}}" -}}
        {{- range slice "series" "categories" "tags" -}}
        {{ printf "{{#%s}}" . }}
        <a {{ printf "href=\"%s%s/%s/\"" $baseURL . $placeholder | safeHTMLAttr }} class="badge post-taxonomy">{{ printf "{{.}}" }}</a>
        {{ printf "{{/%s}}" . }}
        {{- end -}}
      </div>
      <div class="search-result-content mb-3">{{ print "{{{#img}}}<img src=\"{{{img}}}\"/>{{{/img}}}" | safeHTML }}{{ print "{{{content}}}" }}</div>
    </div>
  </div>
</script>
<script type="text/html" id="templateMissingKeywords">
  {{ i18n "search_missing_keywords" }}
</script>
<script type="text/html" id="templateNoResults">
  {{ i18n "search_no_results" }}
</script>
<script type="text/html" id="templateStat">
  {{ i18n "search_stat" (dict "Total" "<span class=\"text-accent\">{{total}}</span>") | safeHTML }}
</script>
{{ end }}
